﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Slja.DBUtility;

namespace Slja.DAL.Common
{
    public class DALUti
    {
        public static DataSet GetPageData(string sql, string orderby, int pageSize, int curPage, out int recordCount)
        {
            SqlParameter[] parms = new SqlParameter[5];
            (parms[0] = new SqlParameter("@sqlStr", SqlDbType.NVarChar, -1)).Value = sql;
            (parms[1] = new SqlParameter("@orderbyStr", SqlDbType.NVarChar, 30)).Value = orderby;
            (parms[2] = new SqlParameter("@pagesize", SqlDbType.Int)).Value = pageSize;
            (parms[3] = new SqlParameter("@curPage", SqlDbType.Int)).Value = curPage;
            (parms[4] = new SqlParameter("@rowcount", SqlDbType.Int)).Direction = ParameterDirection.Output;
            DataSet ds = DbHelperSQL.RunProcedure("dbo.biz_FreePager", parms, "FPGOUT");
            recordCount = (int)parms[4].Value;
            return ds;
        }
    }
}
